<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

use think\Route;


// ++++++++++++++++++++ API 接口 ++++++++++++++++++++ //
//获取小程序openid
Route::post('api/gettoken','api/User/saveToken');
Route::post('api/user/getOpenid','api/User/getOpenid');
Route::post('api/token/app', 'api/User/getAppToken');
// ++++++++++++ 首页 Begin ++++++++++++ //
// 首页数据
Route::rule('api/getHomeFrame', 'api/HomeFrame/getHomeFrame');
// 扫码
Route::rule('api/scanCode', 'api/common/scanCode');
// 搜索
Route::rule('api/searchKeywords', 'api/Product/searchKeywords'); // 热搜
Route::rule('api/searchProduct', 'api/Product/searchProduct'); // 搜索

Route::rule('api/buygifts/getList', 'api/Buygifts/getList'); // 买赠商品列表
Route::rule('api/flashsale/getList', 'api/Flashsale/getList'); // 限时特价商品列表


// ++++++++++++ 品类 Begin ++++++++++++ //
// 首页数据
Route::rule('api/product/getList', 'api/Product/getList'); // 分类下所有商品
Route::rule('api/product/getCategory', 'api/Product/getCategory'); // 商品分类
Route::rule('api/product/activityProducts', 'api/Product/activityProducts'); // 获取活动商品（部分商品）
// 商品详情
Route::rule('api/product/getDetail', 'api/Product/getDetail');
Route::rule('api/product/getCookbooks', 'api/Product/getCookbooks'); // 商品详情 - 菜谱
Route::rule('api/product/getCookbookDetail', 'api/Product/getCookbookDetail'); // 商品详情 - 菜谱详情
Route::rule('api/product/getComments', 'api/Product/getComments'); // 商品详情 - 评价

Route::post('api/checkStock','api/Stock/checkStock');  //单个商品单独检测库存
// 消息
Route::rule('api/message/home', 'api/Message/home'); // 首页
Route::rule('api/message/logistics', 'api/MessageLogistics/getList'); // 交易物流消息
Route::rule('api/message/notice', 'api/MessageNotice/getList'); // 账户通知消息
Route::rule('api/message/activity', 'api/MessageActivity/getList'); // 活动通知消息
Route::rule('api/Activity/getDetail', 'api/Activity/getDetail'); // 活动详情
// ++++++++++++ 品类 End ++++++++++++ //


// ++++++++++++ 购物车 Begin ++++++++++++ //
// 首页数据
Route::rule('api/shoppingcart/getList', 'api/ShoppingCart/getList'); // 购物车列表
Route::rule('api/shoppingcart/updateCart', 'api/ShoppingCart/updateCart'); // 更新购物车 加/减
Route::rule('api/shoppingcart/delete', 'api/ShoppingCart/delete'); // 删除购物车商品
Route::rule('api/shoppingcart/addMultiToCart', 'api/ShoppingCart/addMultiToCart'); // 批量添加到购物车
// ++++++++++++ 购物车 End ++++++++++++ //


// ++++++++++++ 我的 Begin ++++++++++++ //
// 登录&注册
Route::rule('api/user/login', 'api/User/login');
//Route::rule('api/user/shareLogin', 'api/User/shareLogin'); // 分享 登录&注册
// 个人中心页面
Route::rule('api/user/userHome', 'api/User/userHome');
// 个人资料
Route::rule('api/user/userInfo', 'api/User/userInfo');
// 保存个人资料
Route::rule('api/user/saveUser', 'api/User/saveUser');
// 会员俱乐部
Route::rule('api/memberlevel/getList', 'api/Memberlevel/getList'); // 会员等级列表
Route::rule('api/memberlevel/upgrade', 'api/Memberlevel/upgrade'); // 升级/续费 会员等级
Route::rule('api/memberlevel/upgradePay', 'api/Memberlevel/pay'); // 升级/续费 会员等级 - 支付接口
// 积分商城
Route::rule('api/integral/home', 'api/Integralproduct/home'); // 首页
Route::rule('api/integral/getList', 'api/Integralproduct/getList'); // 积分商城列表
Route::rule('api/integral/getDetail', 'api/Integralproduct/getDetail'); // 积分兑换详情
Route::rule('api/integral/exchange', 'api/Integralproduct/exchange'); // 兑换积分
Route::rule('api/integral/getRecords', 'api/Integralproduct/getRecords'); // 积分明细
Route::rule('api/integral/giveintegral', 'api/Integralproduct/consumptiongiveintegral'); // 消费送积分
// 优惠券
Route::rule('api/user/coupon', 'api/User/coupon');
Route::rule('api/coupon/receive', 'api/Coupon/receive'); // 领取优惠券
Route::post('/api/coupon/getOrderCouponList','api/Coupon/getOrderCouponList'); //获取订单可用优惠券列表
// 钱包
Route::rule('api/User/wallet', 'api/User/wallet');
//钱包消费/充值 明细
Route::rule('api/User/walletDetail', 'api/User/walletDetail');
//余额充值
Route::rule('api/User/rechargePay','api/Pay/rechargePay');
// 邀请有礼
Route::rule('api/invitation/getDetail', 'api/Invitation/getDetail');//详情
Route::rule('api/invitation/coupon', 'api/Invitation/coupon'); // 优惠券领取页面
Route::rule('api/invitation/receiveCoupon', 'api/Invitation/receiveCoupon'); // 领取优惠券
Route::rule('api/invitation/getIntegral', 'api/Invitation/getIntegral');//领取积分

// 地址管理
Route::rule('api/address/saveAddress', 'api/Address/saveAddress'); // 保存地址
Route::rule('api/address/delAddress', 'api/Address/delAddress'); // 删除地址
Route::rule('api/address/getAddress', 'api/Address/getAddress'); // 查询所有地址
// ++++++++++++ 我的 End ++++++++++++ //


// 门店自提
Route::rule('api/pickuppoint/getList', 'api/Pickuppoint/getList');

// 发票抬头
Route::rule('api/invoice/getList', 'api/Invoice/getList'); // 列表
Route::rule('api/invoice/save', 'api/Invoice/save'); // 保存
Route::rule('api/invoice/delete', 'api/Invoice/delete'); // 删除

// 商品评价
Route::rule('api/productcomment/getList', 'api/Productcomment/getList'); // 列表
Route::rule('api/productcomment/getDetail', 'api/Productcomment/getDetail'); // 详情
Route::rule('api/productcomment/evaluate', 'api/Productcomment/evaluate'); // 发布评价

// 创建订单
Route::post('api/order/createOrder', 'api/Order/placeOrder');
Route::post('api/order/getFreight','api/Freight/getFreight'); //获取订单运费
Route::post('api/order/pay','api/Pay/getPreOrder'); //支付
Route::post('api/order/getList', 'api/Order/getList'); // 订单列表
Route::rule('api/order/getDetail', 'api/Order/getDetail'); // 详情
Route::rule('api/order/cancelOrder', 'api/Order/cancelOrder'); // 取消未付款订单
Route::rule('api/order/confirmReceive', 'api/Order/confirmReceiveGoods'); // 用户订单确认收货
//Route::rule('api/order/getRefundList', 'api/Order/getRefundList'); // 售后列表
//Route::rule('api/order/getRefundDetails', 'api/Order/getRefundDetails'); // 售后详情

// 订单相关
Route::group('api/order', [
    'getLogistics' => ['api/Order/getLogistics', ['method' => 'post']], // 订单物流查询
    'getfirst_order_price' => ['api/Order/getfirst_order_price',['method' => 'post']] //获取首单立减金额
]);

//拼团相关
Route::group('api/group', [
    'getGroupList' => ['api/Group/groupList', ['method' => 'get']], // 线上拼团商品列表
    'makeGroup' => ['api/Group/makeGroup',['method' => 'post']], //用户开/参团
    'groupDetails' => ['api/Group/groupDetails',['method' => 'post']], //商品拼团详情
    'myGroupList' => ['api/Group/myGroupList',['method' => 'get']]  //我的拼团列表
]);


Route::post('api/getRepurchaseProduct','api/Repurchase/getRepurchaseProduct');//获取可换购商品

// 支付
Route::group('api/pay', [
    'pre_order' => ['api/Pay/getPreOrder', ['method' => 'post']],
    'notifyOff' => ['api/Pay/receiveNotifyOffline', ['method' => 'post']],
    'balance' => ['api/Pay/balancePay', ['method' => 'post']],
    'offlineBalance' => ['api/Pay/offlineBalancePay', ['method' => 'post']],
    'offlineWechat' => ['api/Pay/offlineWecharPay', ['method' => 'post']]
]);

//快递
Route::group('api/express',[
    'getList' => ['api/Express/getExpressList',['method' => 'get']]
]);
Route::rule('api/KuaiDiNiaoNotify/index','api/KuaiDiNiaoNotify/index'); //快递鸟回调接口
//售后
Route::group('api/aftersale',[
    'refund' => ['api/Aftersale/refund',['method'=>'post']],  //申请售后
    'cancelRefund' => ['api/Aftersale/cancelRefund',['method'=>'post']], //取消申请售后
    'getRefund_fee' => ['api/Aftersale/getRefund_fee',['method' => 'get']], //计算退款金额
    'return_goods' => ['api/Aftersale/afterReturn_goods',['method'=>'post']] //用户退货
]);
// 微信支付回调
Route::group('api/weixinNotify', [
    'orderNotify' => ['api/Pay/wxOrderNotify'], // 订单支付回调地址
    'rechargeNotify' => ['api/Pay/wxRechargeNotify'], // 充值支付回调地址
    'memberlevelNotify' => ['api/Pay/wxMemberlevelNotify'], // 升级会员等级支付回调地址
]);
// 支付宝支付回调
Route::group('api/alipayNotify', [
    'orderNotify' => ['api/Pay/alipayOrderNotify'],
    'rechargeNotify' => ['api/Pay/alipayRechargeNotify'],
    'memberlevelNotify' => ['api/Pay/alipayMemberlevelNotify'],
]);


// ++++++++++++ 通用 ++++++++++++ //
// 发送短信验证码
Route::rule('api/sendSmsCode', 'api/Sms/sendSms');
// 验证短信验证码
Route::rule('api/checkSmsCode', 'api/Sms/checkSmsCode');
// 上传单张图片
Route::rule('api/uploadOneImg', 'api/Common/uploadOneImg');
// 删除单张图片
Route::rule('api/delOneImg', 'api/Common/delOneImg');


// ++++++++++++++++++++ 获取微信openID ++++++++++++++++++++ //
//Route::rule('wx/token/user','api/Token/getToken');
